package com.macro.mall.controller;


import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.BasicCollectionManParam;
import com.macro.mall.service.SysCollectionManService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("sys/collectionMan")
public class SysCollectionManController {


    @Autowired
    private SysCollectionManService collectionManService;


    /***
     * 新增采集数据
     * @param param
     * @return
     */
    @PostMapping
    public CommonResult add(@RequestBody BasicCollectionManParam param) {
        return collectionManService.edit(param);
    }


    /***
     * 修改采集数据
     * @param param
     * @return
     */
    @PutMapping
    public CommonResult edit(@RequestBody BasicCollectionManParam param) {
        return collectionManService.edit(param);
    }

    /***
     * 删除采集数据
     * @param id
     * @return
     */
    @DeleteMapping("/{id}")
    public CommonResult delete(@PathVariable(value = "id") String id) {
        return collectionManService.delete(id);
    }

    /***
     * 查询采集数据列表
     * @param param
     * @return
     */
    @GetMapping
    public CommonResult getList(BasicCollectionManParam param) {
        return collectionManService.getList(param);
    }


    /***
     * 查询当前采集数据
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public CommonResult getOne(@PathVariable(value = "id") String id) {
        return collectionManService.getOne(id);
    }


    /***
     * 修改状态
     * @return
     */
    @PutMapping("setStatus")
    public CommonResult setStatus(@RequestBody BasicCollectionManParam param) {
        return collectionManService.edit(param);

    }


    @GetMapping("init")
    public CommonResult init(){
        return collectionManService.init();
    }






}
